<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <!-- 1、引入依赖 -->
  <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
  <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
  <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>

  <div id="app"></div>

  <!-- 2、编写react代码 -->
  <script type="text/babel">

    class App extends React.Component {
      constructor(props){
        super(props)
      }

      // 所有组件必须实现render方法
      render() {
        var elementObj = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
          className: "header"
        }, /*#__PURE__*/React.createElement("h1", {
          title: "\u6807\u9898"
        }, "\u6807\u9898")), /*#__PURE__*/React.createElement("div", {
          className: "content"
        }, /*#__PURE__*/React.createElement("h2", null, "\u9875\u9762\u7684\u5185\u5BB9"), /*#__PURE__*/React.createElement("button", null, "+1"), /*#__PURE__*/React.createElement("a", {
          href: "http://www.baidu.com"
        }, "\u767E\u5EA6\u4E00\u4E0B")), /*#__PURE__*/React.createElement("div", {
          className: "footer"
        }, /*#__PURE__*/React.createElement("p", null, "\u5E95\u90E8\u5185\u5BB9")));
        // jsx -> createElement函数->ReactElement（对象树）->ReactDOM.render -> 真实dom
        // RN jsx -> createElement函数->ReactElement（对象树）->  -> 原生控件
        var elementObj2 = (
          // {}语法  里面可以是表达式
          <div>
            <div className="header">
              <h1 title="标题">标题</h1>
            </div>
            <div className="content">
              <h2>页面的内容</h2>
              <button>+1</button>
              <a href="http://www.baidu.com">百度一下</a>
            </div>
            <div className="footer">
              <p>底部内容</p>
            </div>
          </div>
        )
        console.log(elementObj);
        console.log(elementObj2);
        // 必须用return返回
        return elementObj
      }
    }
    
    ReactDOM.render(<App/>, document.getElementById('app')) 
  </script>
</body>
</html>